package com.example.kafka;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * Project:spring-boot-kafka
 * <p>
 * Title:KafkaMessageConsumer.java
 * <p>
 * Description:
 * <p>
 * Copyrigth:Jiang Software LTD.co Copyright (c) 2021
 * <p>
 * 
 * @version 1.0
 * @since 1.8
 * @author jiang
 * @history 2021 jiang create
 */

@Component
public class MessageConsumer {

	/**
	 * 进行消息接收处理
	 *
	 * @param record
	 */
	@KafkaListener(topics = { "messagekey" })
	public void receiveMessage(ConsumerRecord<String, String> record) {
		System.err.println("【*** 接收消息 ***】 key = " + record.key() + " , value = " + record.value());
	}

}
